org.eclipse.vtp.framework.interactions.voice.vxml
Class Block

java.lang.Object
  extended by org.eclipse.vtp.framework.interactions.core.support.Widget
      extended by org.eclipse.vtp.framework.interactions.voice.vxml.FormElement
          extended by org.eclipse.vtp.framework.interactions.voice.vxml.Block
All Implemented Interfaces:
VXMLConstants

public class Block
extends FormElement

The Block element is used to encapsulate an arbitrary set of actions to be executed during the processing of a VXML Form. The actions are executed in the order in which they are added to the Block instance. Variables can also be declared in a block element and referenced later during the processing of the form.

Version:
2.0
Author:
Trip Gilman, Lonnie Pryor

Field Summary
 
Fields inherited from interface org.eclipse.vtp.framework.interactions.voice.vxml.VXMLConstants
EMPTY, FILE_EXT_GSL, FILLED_MODE_ALL, FILLED_MODE_ANY, GRAMMAR_MODE_DTMF, GRAMMAR_MODE_VOICE, METHOD_GET, METHOD_POST, MIME_TYPE_GSL, MIME_TYPE_SRGS, NAME_APPLICATION, NAME_ASSIGN, NAME_AUDIO, NAME_BARGEIN, NAME_BEEP, NAME_BLOCK, NAME_BRIDGE, NAME_CATCH, NAME_CHOICE, NAME_COMPLETETIMEOUT, NAME_COND, NAME_CONFIDENCELEVEL, NAME_COUNT, NAME_DEST, NAME_DISCONNECT, NAME_DTMF, NAME_DTMFTERM, NAME_ELSE, NAME_ELSEIF, NAME_ENCTYPE, NAME_ENUMERATE, NAME_ERROR, NAME_EVENT, NAME_EVENTEXPR, NAME_EXIT, NAME_EXPR, NAME_FIELD, NAME_FILLED, NAME_FINALSILENCE, NAME_FORM, NAME_GOTO, NAME_GRAMMAR, NAME_ID, NAME_IF, NAME_INCOMPLETETIMEOUT, NAME_INPUTMODES, NAME_INTERDIGITTIMEOUT, NAME_ITEM, NAME_MAXNBEST, NAME_MAXSPEECHTIMEOUT, NAME_MAXTIME, NAME_MENU, NAME_METHOD, NAME_MODE, NAME_NAME, NAME_NAMELIST, NAME_NEXT, NAME_NOINPUT, NAME_NOMATCH, NAME_ONE_OF, NAME_OPTION, NAME_PARAM, NAME_PROMPT, NAME_PROPERTY, NAME_RECORD, NAME_REPEAT, NAME_REPROMPT, NAME_RETURN, NAME_ROOT, NAME_RULE, NAME_SCOPE, NAME_SCRIPT, NAME_SENSITIVITY, NAME_SPEEDVSACCURACY, NAME_SRC, NAME_SUBDIALOG, NAME_SUBMIT, NAME_TERMCHAR, NAME_TERMTIMEOUT, NAME_THROW, NAME_TIMEOUT, NAME_TRANSFER, NAME_TYPE, NAME_VALUE, NAME_VAR, NAME_VERSION, NAME_VXML, NAMESPACE_URI_VXML, QNAME_XML_LANG, SCOPE_DIALOG, SCOPE_DOCUMENT, TYPE_CDATA, VERSION_2_0
 
Constructor Summary
Block(java.lang.String name)
          Creates a new instance of a Block element.
Block(java.lang.String name, java.lang.String expression)
          Creates a new instance of a Block element.
Block(java.lang.String name, java.lang.String expression, java.lang.String condition)
          Creates a new instance of a Block element.
 
Method Summary
 void addAction(Action action)
          Adds the action to the list of actions to perform if this block element is executed.
 void addIfClause(If ifClause)
          Adds a set of conditional actions into the list of actions to perform if this block element is executed.
 void addVariable(Variable variable)
          Adds the specified variable element to this block.
 Widget[] getActionsAndIfClauses()
          Returns the actions and conditionals that this block executes.
 Variable[] getVariables()
          Returns the variables set when this block executes.
 void removeAction(Action action)
          Removes the action from the list of actions to perform if this block element is executed.
 void removeIfClause(If ifClause)
          Removes a set of conditional actions from the list of actions to perform if this block element is executed.
 void removeVariable(Variable variable)
          Removes the specified variable element from this block.
protected  void writeActionsAndIfClauses(org.xml.sax.ContentHandler outputHandler)
          Write the actions and if clauses of this block to the specified content handler.
protected  void writeVariables(org.xml.sax.ContentHandler outputHandler)
          Write the variables in this block to the specified content handler.
 void writeWidget(org.xml.sax.ContentHandler outputHandler)
          Writes the content of this widget to an XML content handler.
 
Methods inherited from class org.eclipse.vtp.framework.interactions.voice.vxml.FormElement
getCondition, getExpression, getName, setCondition, setExpression, setName, writeAttributes
 
Methods inherited from class org.eclipse.vtp.framework.interactions.core.support.Widget
toString, writeAttribute, writeChildren, writeChildren, writeWidget, writeWidget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Block

public Block(java.lang.String name)
      throws java.lang.IllegalArgumentException,
             java.lang.NullPointerException
Creates a new instance of a Block element.

Parameters:
name - The name of the block element.
Throws:
java.lang.IllegalArgumentException - If the specified name is empty.
java.lang.NullPointerException - If the specified name is null.

Block

public Block(java.lang.String name,
             java.lang.String expression)
      throws java.lang.IllegalArgumentException,
             java.lang.NullPointerException
Creates a new instance of a Block element.

Parameters:
name - The name of the block element.
expression - An expression that will set the initial value of the block element.
Throws:
java.lang.IllegalArgumentException - If the specified name is empty.
java.lang.IllegalArgumentException - If the specified expression is empty.
java.lang.NullPointerException - If the specified name is null.

Block

public Block(java.lang.String name,
             java.lang.String expression,
             java.lang.String condition)
      throws java.lang.IllegalArgumentException,
             java.lang.NullPointerException
Creates a new instance of a Block element.

Parameters:
name - The name of the block element.
expression - An expression that will set the initial value of the block element.
condition - An expression that equates to a boolean value which determines if the block will be executed.
Throws:
java.lang.IllegalArgumentException - If the specified name is empty.
java.lang.IllegalArgumentException - If the specified expression is empty.
java.lang.IllegalArgumentException - If the specified condition is empty.
java.lang.NullPointerException - If the specified name is null.
Method Detail

getVariables

public Variable[] getVariables()
Returns the variables set when this block executes.

Returns:
The variables set when this block executes.

getActionsAndIfClauses

public Widget[] getActionsAndIfClauses()
Returns the actions and conditionals that this block executes.

Returns:
The actions and conditionals that this block executes.

addVariable

public void addVariable(Variable variable)
                 throws java.lang.NullPointerException
Adds the specified variable element to this block.

Parameters:
variable - The variable to add.
Throws:
java.lang.NullPointerException - If the specified variable is null.

removeVariable

public void removeVariable(Variable variable)
                    throws java.lang.NullPointerException
Removes the specified variable element from this block.

Parameters:
variable - The variable to remove.
Throws:
java.lang.NullPointerException - If the specified variable is null.

addAction

public void addAction(Action action)
               throws java.lang.NullPointerException
Adds the action to the list of actions to perform if this block element is executed.

Parameters:
action - The action to add.
Throws:
java.lang.NullPointerException - If the specified action is null.

removeAction

public void removeAction(Action action)
                  throws java.lang.NullPointerException
Removes the action from the list of actions to perform if this block element is executed.

Parameters:
action - The action to remove.
Throws:
java.lang.NullPointerException - If the specified action is null.

addIfClause

public void addIfClause(If ifClause)
                 throws java.lang.NullPointerException
Adds a set of conditional actions into the list of actions to perform if this block element is executed.

Parameters:
ifClause - The If clause to add.
Throws:
java.lang.NullPointerException - If the specified if clause is null.

removeIfClause

public void removeIfClause(If ifClause)
                    throws java.lang.NullPointerException
Removes a set of conditional actions from the list of actions to perform if this block element is executed.

Parameters:
ifClause - The If clause to remove.
Throws:
java.lang.NullPointerException - If the specified if clause is null.

writeWidget

public void writeWidget(org.xml.sax.ContentHandler outputHandler)
                 throws java.lang.NullPointerException,
                        org.xml.sax.SAXException
Description copied from class: Widget
Writes the content of this widget to an XML content handler.

Specified by:
writeWidget in class Widget
Parameters:
outputHandler - The handler to write this widget to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of this widget fails.

writeVariables

protected void writeVariables(org.xml.sax.ContentHandler outputHandler)
                       throws java.lang.NullPointerException,
                              org.xml.sax.SAXException
Write the variables in this block to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the variables fails.

writeActionsAndIfClauses

protected void writeActionsAndIfClauses(org.xml.sax.ContentHandler outputHandler)
                                 throws java.lang.NullPointerException,
                                        org.xml.sax.SAXException
Write the actions and if clauses of this block to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the actions or if clauses fails.